package com.cm.caseManagement.service.impl;

import com.cm.caseManagement.utils.DateUtils;

import com.cm.caseManagement.dao.CmApplyRecordMapper;
import com.cm.caseManagement.pojo.entity.CmApplyRecord;
import com.cm.caseManagement.service.ICmApplyRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 申报记录Service业务层处理
 *
 * @author ruoyi
 * @date 2025-10-05
 */
@Service
public class CmApplyRecordServiceImpl implements ICmApplyRecordService
{
    @Autowired
    private CmApplyRecordMapper cmApplyRecordMapper;

    /**
     * 查询申报记录
     *
     * @param id 申报记录主键
     * @return 申报记录
     */
    @Override
    public CmApplyRecord selectCmApplyRecordById(Long id)
    {
        return cmApplyRecordMapper.selectCmApplyRecordById(id);
    }

    /**
     * 查询申报记录列表
     *
     * @param cmApplyRecord 申报记录
     * @return 申报记录
     */
    @Override
    public List<CmApplyRecord> selectCmApplyRecordList(CmApplyRecord cmApplyRecord)
    {
        return cmApplyRecordMapper.selectCmApplyRecordList(cmApplyRecord);
    }

    /**
     * 新增申报记录
     *
     * @param cmApplyRecord 申报记录
     * @return 结果
     */
    @Override
    public int insertCmApplyRecord(CmApplyRecord cmApplyRecord)
    {
        cmApplyRecord.setCreateTime(DateUtils.getNowDate());
        return cmApplyRecordMapper.insertCmApplyRecord(cmApplyRecord);
    }

    /**
     * 修改申报记录
     *
     * @param cmApplyRecord 申报记录
     * @return 结果
     */
    @Override
    public int updateCmApplyRecord(CmApplyRecord cmApplyRecord)
    {
        cmApplyRecord.setUpdateTime(DateUtils.getNowDate());
        return cmApplyRecordMapper.updateCmApplyRecord(cmApplyRecord);
    }

    /**
     * 批量删除申报记录
     *
     * @param ids 需要删除的申报记录主键
     * @return 结果
     */
    @Override
    public int deleteCmApplyRecordByIds(Long[] ids)
    {
        return cmApplyRecordMapper.deleteCmApplyRecordByIds(ids);
    }

    /**
     * 删除申报记录信息
     *
     * @param id 申报记录主键
     * @return 结果
     */
    @Override
    public int deleteCmApplyRecordById(Long id)
    {
        return cmApplyRecordMapper.deleteCmApplyRecordById(id);
    }
}
